home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / QuickTime™ VR 2.0 SDK / Documentation + Extras / Updated Interfaces / QuickDraw 3D 1.5 Interfaces / Interfaces / QD3DErrors.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-22  |  10.0 KB  |  356 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DErrors.h                                             **
  4.  **                                                                             **
  5.  **                                                                             **
  6.  **     Purpose:    Error API and error codes                                 **
  7.  **                                                                             **
  8.  **                                                                             **
  9.  **                                                                             **
  10.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                             **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DError_h
  15. #define QD3DError_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  22. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  23.     #pragma options enum=small
  24. #endif
  25. #include <Types.h>
  26. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  27.     #pragma options enum=reset
  28. #endif
  29. #endif  /*  OS_MACINTOSH  */
  30.  
  31. #if defined(THINK_C) || defined(__SC__)
  32.     #pragma options(!pack_enums, !align_arrays)
  33.     #pragma SC options align=power
  34. #elif defined(__MWERKS__)
  35.     #pragma enumsalwaysint on
  36.     #pragma align_array_members off
  37.     #pragma options align=native
  38. #elif defined(__PPCC__)
  39.     #pragma options align=power
  40. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  41.     #pragma options enum=int
  42. #endif
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif  /*  __cplusplus  */
  47.  
  48.  
  49. /******************************************************************************
  50.  **                                                                             **
  51.  **                            Error Types and Codes                             **
  52.  **                                                                             **
  53.  *****************************************************************************/
  54.  
  55. typedef enum TQ3Error {
  56.     kQ3ErrorNone = 0,        
  57.     /* Fatal Errors */
  58.     kQ3ErrorInternalError            = -28500,
  59.     kQ3ErrorNoRecovery,
  60.     kQ3ErrorLastFatalError,
  61.     /* System Errors */
  62.     kQ3ErrorNotInitialized            = -28490,
  63.     kQ3ErrorAlreadyInitialized,
  64.     kQ3ErrorUnimplemented,
  65.     kQ3ErrorRegistrationFailed,
  66.     /* OS Errors */
  67.     kQ3ErrorUnixError,
  68.     kQ3ErrorMacintoshError,
  69.     kQ3ErrorX11Error,
  70.     /* Memory Errors */
  71.     kQ3ErrorMemoryLeak,
  72.     kQ3ErrorOutOfMemory,
  73.     /* Parameter errors */
  74.     kQ3ErrorNULLParameter,
  75.     kQ3ErrorParameterOutOfRange,
  76.     kQ3ErrorInvalidParameter,            
  77.     kQ3ErrorInvalidData,                
  78.     kQ3ErrorAcceleratorAlreadySet,        
  79.     kQ3ErrorVector3DNotUnitLength,
  80.     kQ3ErrorVector3DZeroLength,
  81.     /* Object Errors */
  82.     kQ3ErrorInvalidObject,
  83.     kQ3ErrorInvalidObjectClass,
  84.     kQ3ErrorInvalidObjectType,
  85.     kQ3ErrorInvalidObjectName,
  86.     kQ3ErrorObjectClassInUse,            
  87.     kQ3ErrorAccessRestricted,
  88.     kQ3ErrorMetaHandlerRequired,
  89.     kQ3ErrorNeedRequiredMethods,
  90.     kQ3ErrorNoSubClassType,
  91.     kQ3ErrorUnknownElementType,
  92.     kQ3ErrorNotSupported,
  93.     /* Extension Errors */
  94.     kQ3ErrorNoExtensionsFolder,
  95.     kQ3ErrorExtensionError,
  96.     kQ3ErrorPrivateExtensionError,
  97.     /* Geometry Errors */
  98.     kQ3ErrorDegenerateGeometry,
  99.     kQ3ErrorGeometryInsufficientNumberOfPoints,
  100.     /* IO Errors */
  101.     kQ3ErrorNoStorageSetForFile,
  102.     kQ3ErrorEndOfFile,
  103.     kQ3ErrorFileCancelled,
  104.     kQ3ErrorInvalidMetafile,
  105.      kQ3ErrorInvalidMetafilePrimitive,
  106.      kQ3ErrorInvalidMetafileLabel,
  107.      kQ3ErrorInvalidMetafileObject,
  108.      kQ3ErrorInvalidMetafileSubObject,
  109.     kQ3ErrorInvalidSubObjectForObject,
  110.     kQ3ErrorUnresolvableReference,
  111.     kQ3ErrorUnknownObject,
  112.     kQ3ErrorStorageInUse,
  113.     kQ3ErrorStorageAlreadyOpen,
  114.     kQ3ErrorStorageNotOpen,
  115.     kQ3ErrorStorageIsOpen,
  116.     kQ3ErrorFileAlreadyOpen,
  117.     kQ3ErrorFileNotOpen,
  118.     kQ3ErrorFileIsOpen,
  119.     kQ3ErrorBeginWriteAlreadyCalled,
  120.     kQ3ErrorBeginWriteNotCalled,
  121.     kQ3ErrorEndWriteNotCalled,
  122.     kQ3ErrorReadStateInactive,
  123.     kQ3ErrorStateUnavailable,
  124.     kQ3ErrorWriteStateInactive,
  125.     kQ3ErrorSizeNotLongAligned,
  126.     kQ3ErrorFileModeRestriction,
  127.     kQ3ErrorInvalidHexString,
  128.     kQ3ErrorWroteMoreThanSize,
  129.     kQ3ErrorWroteLessThanSize,
  130.     kQ3ErrorReadLessThanSize,
  131.     kQ3ErrorReadMoreThanSize,
  132.     kQ3ErrorNoBeginGroup,
  133.     kQ3ErrorSizeMismatch,
  134.     kQ3ErrorStringExceedsMaximumLength,
  135.     kQ3ErrorValueExceedsMaximumSize,
  136.     kQ3ErrorNonUniqueLabel,
  137.     kQ3ErrorEndOfContainer,
  138.     kQ3ErrorUnmatchedEndGroup,
  139.     kQ3ErrorFileVersionExists,
  140.     /* View errors */
  141.     kQ3ErrorViewNotStarted,
  142.     kQ3ErrorViewIsStarted,
  143.     kQ3ErrorRendererNotSet,
  144.     kQ3ErrorRenderingIsActive,
  145.     kQ3ErrorImmediateModeUnderflow,
  146.     kQ3ErrorDisplayNotSet,
  147.     kQ3ErrorCameraNotSet,
  148.     kQ3ErrorDrawContextNotSet,
  149.     kQ3ErrorNonInvertibleMatrix,
  150.     kQ3ErrorRenderingNotStarted,
  151.     kQ3ErrorPickingNotStarted,
  152.     kQ3ErrorBoundsNotStarted,
  153.     kQ3ErrorDataNotAvailable,
  154.     kQ3ErrorNothingToPop,
  155.     /* Renderer Errors */
  156.     kQ3ErrorUnknownStudioType,            
  157.     kQ3ErrorAlreadyRendering,
  158.     kQ3ErrorStartGroupRange,
  159.     kQ3ErrorUnsupportedGeometryType,
  160.     kQ3ErrorInvalidGeometryType,
  161.     kQ3ErrorUnsupportedFunctionality,
  162.     /* Group Errors */
  163.     kQ3ErrorInvalidPositionForGroup,
  164.     kQ3ErrorInvalidObjectForGroup,
  165.     kQ3ErrorInvalidObjectForPosition,
  166.     /* Transform Errors */
  167.     kQ3ErrorScaleOfZero,                
  168.     /* String Errors */
  169.     kQ3ErrorBadStringType,                
  170.     /* Attribute Errors */
  171.     kQ3ErrorAttributeNotContained,        
  172.     kQ3ErrorAttributeInvalidType,        
  173.     /* Camera Errors */
  174.     kQ3ErrorInvalidCameraValues,        
  175.     /* DrawContext Errors */
  176.     kQ3ErrorBadDrawContextType,
  177.     kQ3ErrorBadDrawContextFlag,
  178.     kQ3ErrorBadDrawContext,
  179.     kQ3ErrorUnsupportedPixelDepth,
  180.     /* Controller Errors */
  181.     kQ3ErrorController,
  182.     /* Tracker Errors */
  183.     kQ3ErrorTracker,
  184.     /* Another OS Error */
  185.     kQ3ErrorWin32Error,
  186.     /* Object Errors */
  187.     kQ3ErrorTypeAlreadyExistsAndHasSubclasses,
  188.     kQ3ErrorTypeAlreadyExistsAndOtherClassesDependOnIt,
  189.     kQ3ErrorTypeAlreadyExistsAndHasObjectInstances,
  190.     /*
  191.      * submit loop errors: if you ever get one of these check the previous
  192.      * error posted, it may be kQ3ErrorOutOfMemory.  If so you *may* be able
  193.      * to recover by freeing up some memory and trying again
  194.      */
  195.     kQ3ErrorPickingLoopFailed,
  196.     kQ3ErrorRenderingLoopFailed,
  197.     kQ3ErrorWritingLoopFailed,
  198.     kQ3ErrorBoundingLoopFailed
  199. } TQ3Error;
  200.  
  201. typedef enum TQ3Warning {
  202.     kQ3WarningNone = 0,
  203.     /* General System */
  204.     kQ3WarningInternalException = -28300,    
  205.     /* Object Warnings */
  206.     kQ3WarningNoObjectSupportForDuplicateMethod,
  207.     kQ3WarningNoObjectSupportForDrawMethod,
  208.     kQ3WarningNoObjectSupportForWriteMethod,
  209.     kQ3WarningNoObjectSupportForReadMethod,
  210.     kQ3WarningUnknownElementType,
  211.     kQ3WarningTypeAndMethodAlreadyDefined,
  212.     kQ3WarningTypeIsOutOfRange,
  213.     kQ3WarningTypeHasNotBeenRegistered,
  214.     /* Parameter Warnings */
  215.     kQ3WarningVector3DNotUnitLength,
  216.     /* IO Warnings */
  217.     kQ3WarningInvalidSubObjectForObject,
  218.     kQ3WarningInvalidHexString,
  219.     kQ3WarningUnknownObject,
  220.     kQ3WarningInvalidMetafileObject,
  221.     kQ3WarningUnmatchedBeginGroup,
  222.     kQ3WarningUnmatchedEndGroup,
  223.     kQ3WarningInvalidTableOfContents,
  224.     kQ3WarningUnresolvableReference,
  225.     kQ3WarningNoAttachMethod,
  226.     kQ3WarningInconsistentData,
  227.     kQ3WarningReadLessThanSize,
  228.     kQ3WarningFilePointerResolutionFailed,
  229.     kQ3WarningFilePointerRedefined,
  230.     kQ3WarningStringExceedsMaximumLength,
  231.     /* Memory Warnings */
  232.     kQ3WarningLowMemory,
  233.     kQ3WarningPossibleMemoryLeak,
  234.     /* View Warnings */
  235.     kQ3WarningViewTraversalInProgress,
  236.     kQ3WarningNonInvertibleMatrix,
  237.     /* Quaternion Warning */
  238.     kQ3WarningQuaternionEntriesAreZero,
  239.     /* Renderer Warning */
  240.     kQ3WarningFunctionalityNotSupported,
  241.     /* DrawContext Warning */
  242.     kQ3WarningInvalidPaneDimensions,
  243.     /* Pick Warning */
  244.     kQ3WarningPickParamOutside,
  245.     /* Scale Warnings */
  246.     kQ3WarningScaleEntriesAllZero,
  247.     kQ3WarningScaleContainsNegativeEntries,
  248.     /* Generic Warnings */
  249.     kQ3WarningParameterOutOfRange,
  250.     /* Extension Warnings */
  251.     kQ3WarningExtensionNotLoading,
  252.     /* Object Warnings */
  253.     kQ3WarningTypeAlreadyRegistered,
  254.     kQ3WarningTypeSameVersionAlreadyRegistered,
  255.     kQ3WarningTypeNewerVersionAlreadyRegistered,
  256.     /* Invalid Group Object */
  257.     kQ3WarningInvalidObjectInGroupMetafile
  258. } TQ3Warning;
  259.  
  260.  
  261. typedef enum TQ3Notice {
  262.     kQ3NoticeNone = 0,
  263.     kQ3NoticeDataAlreadyEmpty = -28100,
  264.     kQ3NoticeMethodNotSupported,
  265.     kQ3NoticeObjectAlreadySet,
  266.     kQ3NoticeParameterOutOfRange,
  267.     kQ3NoticeFileAliasWasChanged,
  268.     kQ3NoticeMeshVertexHasNoComponent,
  269.     kQ3NoticeMeshInvalidVertexFacePair,
  270.     kQ3NoticeMeshEdgeVertexDoNotCorrespond,
  271.     kQ3NoticeMeshEdgeIsNotBoundary,
  272.     kQ3NoticeDrawContextNotSetUsingInternalDefaults,
  273.     kQ3NoticeInvalidAttenuationTypeUsingInternalDefaults,
  274.     kQ3NoticeBrightnessGreaterThanOne,
  275.     kQ3NoticeScaleContainsZeroEntries,
  276.     kQ3NoticeSystemAlreadyInitialized,
  277.     kQ3NoticeViewSyncCalledAgain,
  278.     kQ3NoticeFileCancelled
  279. } TQ3Notice;
  280.  
  281. typedef void (QD3D_CALLBACK *TQ3ErrorMethod)(
  282.     TQ3Error    firstError,
  283.     TQ3Error    lastError,
  284.     long        reference);
  285.     
  286. typedef void (QD3D_CALLBACK *TQ3WarningMethod)(
  287.     TQ3Warning    firstWarning,
  288.     TQ3Warning    lastWarning,
  289.     long        reference);
  290.  
  291. typedef void (QD3D_CALLBACK *TQ3NoticeMethod)(
  292.     TQ3Notice    firstNotice,
  293.     TQ3Notice    lastNotice,
  294.     long        reference);
  295.  
  296.  
  297. /******************************************************************************
  298.  **                                                                             **
  299.  **                                Error Routines                                 **
  300.  **                                                                             **
  301.  *****************************************************************************/
  302.  
  303. QD3D_EXPORT TQ3Status QD3D_CALL Q3Error_Register(
  304.     TQ3ErrorMethod        errorPost,
  305.     long                reference);
  306.  
  307. QD3D_EXPORT TQ3Status QD3D_CALL Q3Warning_Register(
  308.     TQ3WarningMethod    warningPost,
  309.     long                reference);
  310.  
  311. QD3D_EXPORT TQ3Status QD3D_CALL Q3Notice_Register(
  312.     TQ3NoticeMethod        noticePost,
  313.     long                reference);
  314.  
  315. /*
  316.  *  Getting error codes -
  317.  *    Clears error type on next entry into system (except all of these 
  318.  *  error calls), and returns the last error, and optionally the 
  319.  *    first error. The parameter to these "_Get" calls may be NULL.
  320.  */
  321. QD3D_EXPORT TQ3Error QD3D_CALL Q3Error_Get(
  322.     TQ3Error            *firstError);
  323.  
  324. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Error_IsFatalError(
  325.     TQ3Error            error);
  326.  
  327. QD3D_EXPORT TQ3Warning QD3D_CALL Q3Warning_Get(
  328.     TQ3Warning            *firstWarning);
  329.  
  330. QD3D_EXPORT TQ3Notice QD3D_CALL Q3Notice_Get(
  331.     TQ3Notice            *firstNotice);
  332.  
  333. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  334.  
  335. QD3D_EXPORT OSErr QD3D_CALL Q3MacintoshError_Get(
  336.     OSErr                *firstMacErr);
  337.  
  338. #endif  /*  OS_MACINTOSH  */
  339. #ifdef __cplusplus
  340. }
  341. #endif  /*  __cplusplus  */
  342.  
  343. #if defined(THINK_C) || defined(__SC__)
  344.     #pragma SC options align=reset
  345. #elif defined(__MWERKS__)
  346.     #pragma enumsalwaysint reset
  347.     #pragma align_array_members reset
  348.     #pragma options align=reset
  349. #elif  defined(__PPCC__)
  350.     #pragma options align=reset
  351. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  352.     #pragma options enum=reset
  353. #endif
  354.  
  355. #endif    /*  QD3DError_h  */
  356.